Journaling on estrip is free and easy. get started today

Last Visit 2017-02-04 19:29:30 |Start Date 2004-08-11 03:13:43 |Comments 356 |Entries 175 |Images 168 |Sounds 4 |Videos 40 |Mobl 32 |Theme |

Category: classic asp

03/28/06 07:39 - ID#22268

Trinary For Classic ASP

Ok So I lied about what the first one would be, but since I'm working with some code that's useing the topic I'm talking about I have examples.


Ok there's no Trianry operator in Classic ASP. For those of you who don't know what I'm talking about it's this kind of syntax that you can find in most bracketed languages. The operator uses two charcters and looks like this " ?: ". It's used like this:


//JavaScript

var sDude = new String("Anakin");
var sMessage = new String();

sMessage = (sDude == "Anakin")?"Jedi":"Sith";

alert(sMessage);

//alerts "Jedi"



But On the server VBScript dosen't have anyoperators like that which I find are quite a line saver in other languages. Trianry has been found in other places VBScript has been used like VBA (Visual Basic for Applications), and when it is supported it look like a function/language construct called IIf.

A work around for this that I've found usefull was to define a function for the trinary operation, or inline if, or immeidate if as it's been called. Like so


'VBScript
'RunAt=Server

Function IIf(varTest, varTrue, varFalse)
If varTest Then IIf = varTrue Else IIf = varFalse
End Function




But be wary children, you must declare each parameter or you'll get an error.

I'll try to only post things that I think are hard to find answers and things that I at least have a solid work around for. Otherwise happy coding.

--muja
print add/read comments

Permalink: Trinary_For_Classic_ASP.html
Words: 242


Category: classic asp

03/28/06 07:18 - ID#22267

Classic ASP

I program in Classic ASP at work, though I'm moving to .NET soon.

Still there are a lot of programmers that program in Classic ASP, and don't have an option to change that could use a resource like I hope this journal posting will become.

I'm going to keep updating this journal everytime I find something wonky with Classic ASP that I've figured out.

Maybe I'll start a profile called William Gates where I can post these things. Ooh, or maybe I'll just start a category called Classic ASP (enknot's kinda slow sometimes kids, you're going to have to forgive him.)

First one's first is the Data Dictionary .Add Bug...yeah.
print addComment

Permalink: Classic_ASP.html
Words: 111


Search

Chatter

New Site Wide Comments

joe said to joe
Never send a man to do a grandma's job...

sina said to sina
yes thank you!
Well, since 2018 I am living in France, I have finished my second master of science,...

paul said to sina
Nice to hear from you!! Hope everything is going great....

paul said to twisted
Hello from the east coast! It took me so long to see this, it might as well have arrived in a lette...